<?php

namespace Modules\Common\Models;

use Modules\Common\Models\Validation\EbooksValidation;


class Ebooks extends BaseModel
{
    protected $connection = 'mysql';
    protected $table = 'ebooks';
    use EbooksValidation;
    

    public function category()
    {
        return $this->belongsTo(Categories::class, 'category_id');
    }

    public function adminUser()
    {
        return $this->belongsTo(AdminUser::class, 'admin_user_id');
    }
    

    public function bookshelf()
    {
        return $this->hasMany(Bookshelf::class, 'ebook_id');
    }

    public function orders()
    {
        return $this->hasMany(Orders::class, 'ebook_id');
    }
    
    public function userReadingRecords()
    {
        return $this->hasMany(UserReadingRecords::class, 'ebook_id');
    }
}